import request from '@/config/axios'

export interface CommunitVo {
  id: number
  parentId: number
  name: string
  villageSign: boolean
  remark: string
  cloudLinkId: number,
  extendAttrs: string
}

// 查询列表
export const listCommunity = async (params: any) => {
  return await request.get({
    url: '/zwsj/community/list',
    params: params
  })
}

// 获取社区简信息列表
export const listSimpleCommunitys = async () => {
  return await request.get({
    url: '/zwsj/community/list-all-simple'
  })
}

// 创建区域	管理
export const createCommunity = async (data: CommunitVo) => {
  return await request.post({
    url: '/zwsj/community/create',
    data: data
  })
}

// 更新区域	管理
export const updateCommunity = async (data: CommunitVo) => {
  return await request.put({
    url: '/zwsj/community/update',
    data: data
  })
}

// 删除区域	管理
export const deleteCommunity = async (id: number) => {
  return await request.delete({
    url: `/zwsj/community/delete?id=` + id
  })
}

// 获得区域	管理
export const getCommunity = async (id: number) => {
  return await request.get({
    url: `/zwsj/community/get?id=` + id
  })
}
